/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: syyyy
 * Date: 2025-08-12
 * Time: 15:29
 */
public class Test {

        // 计算一个数的真约数和（不包括自身）
        public static int sumOfProperDivisors(int num) {
            if (num == 1) {
                return 0;
            }
            int sum = 1;
            for (int j = 2; j * j <= num; j++) {
                if (num % j == 0) {
                    sum += j;
                    if (j != num / j) {
                        sum += num / j;
                    }
                }
            }
            return sum;
        }

        // 查找并统计 1000 以内的相亲数对数量
        public static int findAmicableNumbersCount() {
            int count = 0;
            for (int a = 2; a < 1000; a++) {
                int b = sumOfProperDivisors(a);
                if (b > a && b < 1000 && sumOfProperDivisors(b) == a) {
                    System.out.println(a + " 和 " + b + " 是相亲数");
                    count++;
                }
            }
            return count;
        }



    public static void main(String[] args) {
        MyStackUseQueue s=new MyStackUseQueue();
        s.push(12);
        s.push(23);
        s.push(34);
        s.push(45);
        s.push(56);

//        int top=s.top();
//        System.out.println(top);
        int top=s.pop();
        System.out.println(top);
        int top2=s.top();
        System.out.println(top2);
        s.pop();
        int top3=s.top();
        System.out.println(top3);
    }
}
